﻿@using FCZLM.Core.Models;
@using Microsoft.AspNetCore.Http
@{
    Layout = null;

}
@model Admin
<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>Edit</title>
    <link href="~/layui/css/layui.css" rel="stylesheet" />
  
</head> 
<body>
    <div>
        <div class="layui-card">
            <div class="layui-card-header">修改密码</div>
            <div class="layui-card-body">
                <form class="layui-form">
                    <div class="layui-form-item">
                        <label class="layui-form-label">登录名</label>
                        <div class="layui-input-block">
                            <input type="text" name="LoginName" value="@{
                                @Context.Session.GetString(key:"a")
}" required lay-verify="required" placeholder="请输入名字" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">新密码</label>
                        <div class="layui-input-block">
                            <input type="password" name="LoginPwd" value="" required lay-verify="required" placeholder="请输入密码" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <div class="layui-input-block">
                            <button class="layui-btn" lay-submit lay-filter="editForm">修改</button>
                            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                            <button id="close" class="layui-btn layui-btn-primary">取消</button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
    <script src="~/layui/layui.js"></script>
    <script>
        //使用Ajax方式
        layui.use(["form", 'layer'], function () {
            var form = layui.form;
            var $ = layui.$;//引入layui组件
            //监听提交
            form.on('submit(editForm)', function (data) {
                $.post("/FLogin/EditLogin", data.field, function (res) {
                    if (res.isSuccess) {
                        layer.msg(res.msg, function () {
                            parent.window.location.href = "/flogin/index";
                        });
                    } else {
                       layer.msg(res.msg);
                    }
                });
             
                return false;
            });
        });
    </script>
</body>
</html>
